<template>
	<view class="uni-goods-nav">
		<!-- 底部占位 -->
		<view class="uni-tab__seat" />
		<view class="uni-tab__cart-box flex">
			<view class="flex uni-tab__cart-sub-left">
				<view v-for="(item,index) in options" :key="index" class="flex uni-tab__cart-button-left uni-tab__shop-cart" @click="onClick(index,item)">
					<view class="uni-tab__icon">
						<uni-icons v-if="item.icon" :type="item.icon" size="20" color="#646566"></uni-icons>
						<text  v-if="item.iconfont" class="iconfont" :class="item.iconfont"></text>
					</view>
					<text class="uni-tab__text">{{ item.text }}</text>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	/**
	 * 导航
	 * @description
	 * @property {Array} options 组件参数
	 * @property {Boolean} fill = [true | false] 组件按钮组参数
	 * @event {Function} click 左侧点击事件
	 * @example <uni-nav :fill="true"  options=""   @click=""  />
	 */
	export default {
		name: 'StUniNav',
		props: {
			options: {
				type: Array,
				default () {
					return [{
						iconfont: 'shop',
						icon: 'shop',
						text: '店铺',
					}, {
						iconfont: 'cart',
						icon: 'cart',
						text: '购物车'
					}]
				}
			}
		},
		methods: {
			onClick(index, item) {
				this.$emit('click', {
					index,
					content: item,

				})
			}
		}
	}
</script>

<style lang="scss" scoped>
	.flex {
		/* #ifndef APP-NVUE */
		display: flex;
		/* #endif */
		flex-direction: row;
	}

	.uni-goods-nav {
		/* #ifndef APP-NVUE */
		display: flex;
		/* #endif */
		flex: 1;
		flex-direction: row;
	}

	.uni-tab__cart-box {
		flex: 1;
		height: 50px;
		background-color: #fff;
		z-index: 900;
	}

	.uni-tab__cart-sub-left {
		padding: 0 5px;
	}

	.uni-tab__cart-sub-right {
		flex: 1;
	}

	.uni-tab__right {
		margin: 5px 0;
		margin-right: 10px;
		border-radius: 100px;
		overflow: hidden;
	}

	.uni-tab__cart-button-left {
		/* #ifndef APP-NVUE */
		display: flex;
		/* #endif */
		// flex: 1;
		position: relative;
		justify-content: center;
		align-items: center;
		flex-direction: column;
		margin: 0 10px;
		/* #ifdef H5 */
		cursor: pointer;
		/* #endif */
	}

	.uni-tab__icon {
		width: 18px;
		height: 18px;
		line-height: 1 !important;
	}

	.image {
		width: 18px;
		height: 18px;
	}

	.uni-tab__text {
		margin-top: 3px;
		font-size: $uni-font-size-sm;
		color: #353637;
	}
</style>
